﻿#ifndef _BRICKEX_H_
#define _BRICKEX_H_

#include "Object.h"
#include "Sprite.h"

#define GRAVITY		0.01


class BrickEx : public Object
{
	float _xOld;
	float _yOld;

	/*float _vx;
	float _vy;*/

	//float _accelY;

	bool isLastMoveUp;			//kiem tra gach co duoc day len chua?

	Sprite* _spriteArr[4];
	bool isBreaked;

	float	xBreak1;		//Tham số của các mảnh vỡ. 1 là mảnh trên, 2 là mảnh dưới
	float	yBreak1;
	float	xBreak2;
	float	yBreak2;
	float	vyBreak1;
	float	vyBreak2;
	float	vxBreak1;
	float	vxBreak2;
	float	ayBreak;
	float	angle;
public:

	/*
	 *	Constructor
	 */
	BrickEx(LPDIRECT3DDEVICE9 d3ddv, LPDIRECT3DSURFACE9 BackBuffer, LPD3DXSPRITE SpriteHandler, float x, float y, int ID, int Obj_state);
	~BrickEx();

	
	/*
	 *	Method
	 */
	//void render();
	void render(int cameraX, int cameraY);
	void update(list<Object*>* obj_list, DxInput* input, float TPF);

	
	OBJECT_TYPE getObjectType();


	
	void changeState(int state);
};

#endif